﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Skynet.BusinessEntities;
using Microsoft.Practices.Unity;
using System.Xml;
using System.Windows.Markup;
using System.IO;

namespace Skynet.Administracion.Views.ExamCategoryMgm
{
    /// <summary>
    /// Interaction logic for CategoriaExamenesMgmView.xaml
    /// </summary>
    /// 
    [Infrastructure.WpfClient.Composite.Regions.ModalWindow.ModalWindowsInfo(   ResizeMode.CanResize ,  System.Windows.SizeToContent.Manual, false)]
    public partial class ExamCategoryMgmView : UserControl , IExamCategoryMgmView
    {
        private ExamCategoryMgmPresenter _Presenter;
        [Dependency]
        public ExamCategoryMgmPresenter Presenter
        {
            get { return _Presenter; }
            set { _Presenter = value;
            _Presenter.View = this;
            this.DataContext = value;
            }
        }
        public static RoutedCommand NewCommand = new RoutedCommand();

        public ExamCategoryMgmView()
        {
            InitializeComponent();
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.Presenter.OnViewReady();

            // Do not load your data at design time.
            // if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
            // {
            // 	//Load your data here and assign the result to the CollectionViewSource.
            // 	System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["Resource Key for CollectionViewSource"];
            // 	myCollectionViewSource.Source = your data
            // }
            // Do not load your data at design time.
            // if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
            // {
            // 	//Load your data here and assign the result to the CollectionViewSource.
            // 	System.Windows.Data.CollectionViewSource myCollectionViewSource = (System.Windows.Data.CollectionViewSource)this.Resources["Resource Key for CollectionViewSource"];
            // 	myCollectionViewSource.Source = your data
            // }
        }

        private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            this.MaintenanceExpander.DataContext = new ExamCategory() { Title = "Ingrese Categoria" };
            this.MaintenanceExpander.IsExpanded = true;
        }

        public string TextDocument
        {
            get
            {
                return this.txtDescription.Document;
            }
            set
            {
                this.txtDescription.Document = value;  
            }
        }

        private void categoriaExamDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

           (this.categoriaExamDataGrid.SelectedItem as ExamCategory).StartTracking();
           this.MaintenanceExpander.DataContext =   this.categoriaExamDataGrid.SelectedItem as ExamCategory;
           this.MaintenanceExpander.IsExpanded = true;
        }
    }
}
